import React from 'react'
import CommonTable from '@/common/CommonTable'
import { tableConfig, dataSource } from './config'
import _ from 'lodash'

const TableColRowHB = () => {
  const tableProps = {
    columns: _.map(tableConfig, (item, key) => {
      const obj = { ...item }
      switch (obj.dataIndex) {
        case 'age':
          obj.render = (text, record, index) => {
            if (index === 1) {
              return {
                props: {
                  rowSpan: 0,
                },
              }
            }
            return {
              children: text,
              props: {
                rowSpan: 2,
              },
            }
          }
          break

        default:
          break
      }
      return obj
    }),
    dataSource,
    bordered: true,
  }
  return <CommonTable {...tableProps} />
}
export default TableColRowHB
